package com.dotflat.staffExtend.repository;

import com.dotflat.staffExtend.domain.StaffExtendInfoRankCircle;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface StaffExtendInfoRankCircleRepository extends JpaRepository<StaffExtendInfoRankCircle, String>, JpaSpecificationExecutor<StaffExtendInfoRankCircle> {

    @Query(value = "select * from ex_staff_extend_rank_circle c where c.areaId is null or c.areaId = ?1 order by beginDate desc, sort desc, created desc", nativeQuery = true)
    StaffExtendInfoRankCircle findFirstByAreaId(String areaId);

}
